import { get, post, put, remove } from "./index";

export function oneById(id) {
  return get("card/" + id);
}

export function page(query) {
  return get("card/page", query);
}

export function list(query) {
  return get("card/list", query);
}

export function excel(query) {
  return post("card/export", query);
}

export function create(data) {
  return post("card", data);
}

export function update(data) {
  return put("card", data);
}

export function deleteById(id) {
  return remove("card/" + id);
}

// 用户头像上传
export function uploadAvatar(data) {
  return post("card/avatar", data);
}

export function createUser(data) {
  return post("card/user", data);
}

export function updateUser(data) {
  return put("card/user", data);
}

export function change(deviceId) {
  return get("card/change/" + deviceId);
}

export default {
  oneById,
  page,
  list,
  excel,
  create,
  update,
  uploadAvatar,
  deleteById,
  createUser,
  updateUser,
  change,
};
